﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace YXShop.Web.admin.accessories
{
    public partial class questionnaire_list : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack){
                YXShop.Common.PromptInfo.Popedom("012002001");

                this.litQuest.Text = GetList();
            }
        }
        public string GetList()
        {
           
            ChangeHope.WebPage.Table table = new ChangeHope.WebPage.Table();
            YXShop.BLL.Accessories.Questionnaire questBll = new YXShop.BLL.Accessories.Questionnaire();
            ChangeHope.DataBase.DataByPage dataPage = questBll.GetAllList();
            table.AddHeadCol("","选择");
            table.AddHeadCol("","问卷名称");
            table.AddHeadCol("","结束时间");
            table.AddHeadCol("","问卷状态");
          //table.AddHeadCol("","常规管理操作");
            table.AddHeadCol("","题目操作");
            table.AddRow();
            if(dataPage.DataReader!=null){             
                while(dataPage.DataReader.Read()){
                    table.AddCol("<input id=\"cbTm\"  type=\"checkbox\" value=" + dataPage.DataReader["quest_id"] + " />");
                    table.AddCol(dataPage.DataReader["quest_name"].ToString());
                    table.AddCol(dataPage.DataReader["quest_endtime"].ToString());
                    table.AddCol(dataPage.DataReader["quest_appearance"].ToString()=="0"?"未启用":"已启用");
                 // table.AddCol("<a href=\'#?Quest_ID=" + dataPage.DataReader["quest_id"] + "'>编辑</a>  <a href=\"#\" onclick='Del(" + dataPage.DataReader["quest_id"] + ")'> 删除</a>");
                    table.AddCol("<a href='question_edit.aspx?Action=Add&QuestID=" + dataPage.DataReader["quest_id"] + "'>添加</a>  <a href='question_list.aspx?QuestID=" + dataPage.DataReader["quest_id"] + "'>问题列表</a>");
                    table.AddRow();
                }
            }
            string view = table.GetTable() + dataPage.PageToolBar;
            dataPage.Dispose();
            dataPage = null;
            return view;
        }
    }
}
